package com.unionpay.mobile.android.pboctransaction;

import android.os.Build.VERSION;
import android.os.Bundle;
import com.unionpay.mobile.android.fully.a;
import com.unionpay.mobile.android.utils.PreferenceUtils;
import com.unionpay.mobile.android.utils.h;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;

public final class d
{
  public static String a = "A0000003330101010000000000010000";
  public static String b = "A0000003330101020001050001000000";
  private static Date l = new Date(System.currentTimeMillis());
  private static String m = new SimpleDateFormat("yyyyMMddhhmmss").format(l);
  private static HashMap<String, String> o = new HashMap();
  private static d r = null;
  c c;
  a d;
  public boolean e = false;
  private String f = "1.4";
  private byte g = 0;
  private byte h = 0;
  private byte i = 1;
  private boolean j = true;
  private boolean k = true;
  private String n = null;
  private boolean p = false;
  private String q = "";

  public d(c paramc, a parama, String paramString)
  {
    this.f = paramString;
    this.c = paramc;
    this.d = parama;
  }

  private static String a(String paramString1, String paramString2)
  {
    int i1 = 1;
    if (paramString1 == null)
      return null;
    byte[] arrayOfByte1 = e.a(paramString1);
    int i2 = 0;
    if (i2 < arrayOfByte1.length)
      if ((byte)(0x1F & arrayOfByte1[i2]) != 31)
        break label529;
    label517: label529: for (int i3 = 2; ; i3 = i1)
    {
      byte[] arrayOfByte2 = new byte[i3];
      System.arraycopy(arrayOfByte1, i2, arrayOfByte2, 0, i3);
      int i9;
      int i10;
      if (e.a(arrayOfByte2, i3).compareToIgnoreCase(paramString2) == 0)
      {
        i9 = i3 + i2;
        if ((byte)(0x80 & arrayOfByte1[i9]) != -128)
          i10 = 0xFF & arrayOfByte1[i9];
      }
      while (true)
      {
        byte[] arrayOfByte3 = new byte[i10];
        System.arraycopy(arrayOfByte1, i9 + i1, arrayOfByte3, 0, i10);
        return e.a(arrayOfByte3, i10);
        i1 = 1 + (0x7F & arrayOfByte1[i9]);
        if (i1 == 2)
        {
          i10 = 0xFF & arrayOfByte1[(i9 + 1)];
        }
        else if (i1 == 3)
        {
          i10 = (0xFF & arrayOfByte1[(i9 + 1)]) << 8 | 0xFF & arrayOfByte1[(i9 + 2)];
        }
        else if (i1 == 4)
        {
          i10 = (0xFF & arrayOfByte1[(i9 + 1)]) << 16 | (0xFF & arrayOfByte1[(i9 + 2)]) << 8 | 0xFF & arrayOfByte1[(i9 + 3)];
          continue;
          int i7;
          if ((0x20 & arrayOfByte1[i2]) == 32)
          {
            i7 = i3 + i2;
            if ((i7 >= arrayOfByte1.length) || ((byte)(0x80 & arrayOfByte1[i7]) != -128))
              break label517;
          }
          for (int i8 = 1 + (0x7F & arrayOfByte1[i7]); ; i8 = i1)
          {
            i2 = i8 + i7;
            break;
            int i4 = i2 + i3;
            int i6;
            if ((i4 < arrayOfByte1.length) && ((byte)(0x80 & arrayOfByte1[i4]) == 0))
            {
              i6 = 0xFF & arrayOfByte1[i4];
              i5 = i1;
              i2 = i4 + (i6 + i5);
              break;
            }
            if (i4 < arrayOfByte1.length);
            for (int i5 = 1 + (0x7F & arrayOfByte1[i4]); ; i5 = 0)
            {
              if ((i5 == 2) && (i4 + 1 < arrayOfByte1.length))
              {
                i6 = 0xFF & arrayOfByte1[(i4 + 1)];
                break;
              }
              if ((i5 == 3) && (i4 + 2 < arrayOfByte1.length))
              {
                i6 = (0xFF & arrayOfByte1[(i4 + 1)]) << 8 | 0xFF & arrayOfByte1[(i4 + 2)];
                break;
              }
              if ((i5 == 4) && (i4 + 2 < arrayOfByte1.length))
              {
                i6 = (0xFF & arrayOfByte1[(i4 + 1)]) << 16 | (0xFF & arrayOfByte1[(i4 + 2)]) << 8 | 0xFF & arrayOfByte1[(i4 + 3)];
                break;
                return null;
              }
              i6 = 0;
              break;
            }
          }
        }
        else
        {
          i10 = 0;
        }
      }
    }
  }

  private static String a(String paramString, boolean paramBoolean)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    byte[] arrayOfByte1 = paramString.toUpperCase().getBytes();
    int i1 = arrayOfByte1.length;
    for (int i2 = 0; i2 < i1; i2++)
    {
      Object[] arrayOfObject = new Object[1];
      arrayOfObject[0] = Byte.valueOf(arrayOfByte1[i2]);
      localStringBuffer.append(String.format("%02X", arrayOfObject));
    }
    int i3 = localStringBuffer.length() / 2 + localStringBuffer.length() % 2;
    if (!paramBoolean)
      if (i3 % 8 == 0)
        break label199;
    label199: for (int i5 = i3 + (8 - i3 % 8); ; i5 = i3)
    {
      byte[] arrayOfByte3 = new byte[i5];
      System.arraycopy(e.a(localStringBuffer.toString()), 0, arrayOfByte3, 0, i3);
      return e.a(arrayOfByte3, i5);
      int i4 = i3 + 1;
      if (i4 % 8 != 0)
        i4 += 8 - i4 % 8;
      byte[] arrayOfByte2 = new byte[i4];
      System.arraycopy(e.a(localStringBuffer.toString()), 0, arrayOfByte2, 0, i3);
      arrayOfByte2[i3] = -128;
      return e.a(arrayOfByte2, i4);
    }
  }

  private String a(byte[] paramArrayOfByte)
  {
    paramArrayOfByte[0] = ((byte)(paramArrayOfByte[0] | this.g));
    byte[] arrayOfByte1 = this.c.a(paramArrayOfByte, this.g);
    int i1;
    label114: byte[] arrayOfByte2;
    int i2;
    if (arrayOfByte1 != null)
    {
      i1 = arrayOfByte1.length;
      if ((i1 >= 2) && (arrayOfByte1[(i1 - 2)] == 97))
      {
        int i3 = arrayOfByte1[(i1 - 1)];
        byte[] arrayOfByte3 = new byte[5];
        arrayOfByte3[0] = this.g;
        arrayOfByte3[1] = -64;
        arrayOfByte3[2] = 0;
        arrayOfByte3[3] = 0;
        arrayOfByte3[4] = i3;
        arrayOfByte1 = this.c.a(arrayOfByte3, this.g);
        if (arrayOfByte1 == null)
          break label212;
        i1 = arrayOfByte1.length;
      }
      if ((i1 < 2) || (arrayOfByte1[(i1 - 2)] != 108))
        break label254;
      paramArrayOfByte[(-1 + paramArrayOfByte.length)] = arrayOfByte1[(i1 - 1)];
      arrayOfByte2 = this.c.a(paramArrayOfByte, this.g);
      i2 = 0;
      if (arrayOfByte2 != null)
        i2 = arrayOfByte2.length;
    }
    while (true)
    {
      if ((i2 > 2) && (arrayOfByte2[(i2 - 2)] == -112) && (arrayOfByte2[(i2 - 1)] == 0))
      {
        return e.a(arrayOfByte2, i2 - 2);
        i1 = 0;
        break;
        label212: i1 = 0;
        break label114;
      }
      if ((i2 == 2) && (arrayOfByte2[(i2 - 2)] == -112) && (arrayOfByte2[(i2 - 1)] == 0))
        return e.a(arrayOfByte2, 2);
      return null;
      label254: i2 = i1;
      arrayOfByte2 = arrayOfByte1;
    }
  }

  private String a(byte[] paramArrayOfByte, String paramString)
  {
    paramArrayOfByte[(-1 + paramArrayOfByte.length)] = ((byte)(paramString.length() / 2));
    byte[] arrayOfByte = new byte[paramArrayOfByte.length + paramString.length() / 2];
    System.arraycopy(paramArrayOfByte, 0, arrayOfByte, 0, paramArrayOfByte.length);
    System.arraycopy(e.a(paramString), 0, arrayOfByte, paramArrayOfByte.length, paramString.length() / 2);
    return a(arrayOfByte);
  }

  private static void a(String paramString, StringBuffer paramStringBuffer)
  {
    String str1 = (String)o.get(paramString);
    byte[] arrayOfByte = new byte[1];
    arrayOfByte[0] = ((byte)(str1.length() / 2));
    String str2 = e.a(arrayOfByte, arrayOfByte.length);
    paramStringBuffer.append(paramString);
    paramStringBuffer.append(str2);
    paramStringBuffer.append(str1);
  }

  private String b(String paramString)
  {
    this.g = this.h;
    String str1 = null;
    if (paramString != null)
    {
      Integer localInteger = Integer.valueOf(paramString.length() / 2);
      byte[] arrayOfByte = new byte[1];
      arrayOfByte[0] = localInteger.byteValue();
      String str2 = e.a(arrayOfByte, arrayOfByte.length);
      str1 = a(e.a("00a40400" + str2 + paramString));
    }
    return str1;
  }

  private void b(byte[] paramArrayOfByte)
  {
    int i1 = 1 + m.length() / 2;
    byte[] arrayOfByte1 = new byte[i1];
    System.arraycopy(e.a(m), 0, arrayOfByte1, 0, m.length() / 2);
    arrayOfByte1[(i1 - 1)] = -128;
    paramArrayOfByte[(-1 + paramArrayOfByte.length)] = ((byte)arrayOfByte1.length);
    byte[] arrayOfByte2 = new byte[paramArrayOfByte.length + arrayOfByte1.length];
    System.arraycopy(paramArrayOfByte, 0, arrayOfByte2, 0, paramArrayOfByte.length);
    System.arraycopy(arrayOfByte1, 0, arrayOfByte2, paramArrayOfByte.length, arrayOfByte1.length);
    a(arrayOfByte2);
  }

  private String c(String paramString)
  {
    int i1 = 0;
    String str1 = a(paramString, "80");
    if (str1 == null)
      return null;
    o.put("82", str1.substring(0, 4));
    byte[] arrayOfByte1 = e.a(str1.substring(4));
    ArrayList localArrayList = new ArrayList();
    localArrayList.add("5A");
    localArrayList.add("5F34");
    localArrayList.add("9F1F");
    localArrayList.add("57");
    localArrayList.add("5F24");
    localArrayList.add("9F10");
    localArrayList.add("8C");
    localArrayList.add("8D");
    int i2;
    int i3;
    label192: int i4;
    try
    {
      if (i1 < arrayOfByte1.length)
      {
        byte[] arrayOfByte2 = { 0, -78, 0, 0, 0 };
        byte[] arrayOfByte3 = new byte[4];
        System.arraycopy(arrayOfByte1, i1, arrayOfByte3, 0, 4);
        i2 = i1 + 4;
        i3 = arrayOfByte3[1];
        if (i3 <= arrayOfByte3[2])
        {
          arrayOfByte2[4] = 0;
          arrayOfByte2[3] = ((byte)(0x4 | 0xFFFFFFF8 & arrayOfByte3[0]));
          arrayOfByte2[2] = i3;
          i4 = (byte)(i3 + 1);
          String str2 = a(arrayOfByte2);
          if (str2 != null)
          {
            Iterator localIterator = localArrayList.iterator();
            while (localIterator.hasNext())
            {
              String str3 = (String)localIterator.next();
              String str4 = a(str2, str3);
              if (str4 != null)
                o.put(str3, str4);
            }
          }
        }
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    while (true)
    {
      return (String)o.get("8C");
      i3 = i4;
      break label192;
      i1 = i2;
      break;
      StringBuffer localStringBuffer = new StringBuffer((String)o.get("5F34"));
      localStringBuffer.insert(0, "0");
      o.put("5F34", localStringBuffer.toString());
    }
  }

  private String d(String paramString)
  {
    StringBuffer localStringBuffer = new StringBuffer("80AE800034");
    Iterator localIterator1 = h(paramString).iterator();
    while (true)
    {
      if (!localIterator1.hasNext())
        break label105;
      String str2 = (String)localIterator1.next();
      Iterator localIterator2 = o.keySet().iterator();
      if (localIterator2.hasNext())
      {
        String str3 = (String)localIterator2.next();
        if (str2.compareToIgnoreCase(str3) != 0)
          break;
        localStringBuffer.append((String)o.get(str3));
      }
    }
    label105: String str1 = a(e.a(localStringBuffer.toString()));
    if (str1 != null)
    {
      o.put("9F27", str1.substring(4, 6));
      o.put("9F36", str1.substring(6, 10));
      o.put("9F26", str1.substring(10, 26));
      o.put("9F10", str1.substring(26));
    }
    return str1;
  }

  private static void d()
  {
    String str = m.substring(2, 8);
    o.put("9F26", "");
    o.put("9F27", "80");
    o.put("9F10", "");
    o.put("9F37", "00000000");
    o.put("9F36", "");
    o.put("95", "0000000800");
    o.put("9A", str);
    o.put("9C", "45");
    o.put("9F02", "000000000000");
    o.put("5F2A", "0156");
    o.put("82", "");
    o.put("9F1A", "0156");
    o.put("9F03", "000000000000");
    o.put("9F33", "A04000");
    o.put("9F34", "000000");
    o.put("9F35", "34");
    o.put("9F1E", "3030303030303030");
    o.put("84", "");
    o.put("9F09", "0001");
    o.put("9F74", "");
    o.put("9F63", "");
    o.put("9F7A", "01");
    o.put("9F21", m.substring(8));
    o.put("9F4E", "0000000000000000000000000000000000000000");
    o.put("DF31", "0100000000");
  }

  private String e(String paramString)
  {
    this.g = this.i;
    byte[] arrayOfByte1 = { -128, 26, 19, 1, 0 };
    byte[] arrayOfByte2 = { -128, -6, 0, 0, 0 };
    String str1 = a(paramString, false);
    b(arrayOfByte1);
    String str2 = a(arrayOfByte2, str1);
    this.g = this.h;
    return str2;
  }

  private boolean e()
  {
    for (String str1 = (String)o.get("5A"); str1.substring(-1 + str1.length(), str1.length()).equalsIgnoreCase("f"); str1 = str1.substring(0, -1 + str1.length()));
    String str2 = e(str1);
    if ((str2 == null) || (str2.length() == 0))
      return false;
    o.put("AN1", str2);
    String str3 = e("00000001");
    if ((str3 == null) || (str3.length() == 0))
      return false;
    o.put("TID", str3);
    String str4 = e((String)o.get("9F02"));
    if ((str4 == null) || (str4.length() == 0))
      return false;
    o.put("AMT", str4);
    String str5 = e("156");
    if ((str5 == null) || (str5.length() == 0))
      return false;
    o.put("CUR", str5);
    for (String str6 = (String)o.get("57"); (str6.substring(-1 + str6.length(), str6.length()).equalsIgnoreCase("f")) || (str6.substring(-1 + str6.length(), str6.length()).equalsIgnoreCase("F")); str6 = str6.substring(0, -1 + str6.length()));
    String str7 = e(str6);
    if ((str7 == null) || (str7.length() == 0))
      return false;
    o.put("TD2", str7);
    if ((o.get("5F24") != null) && (((String)o.get("5F24")).length() == 6))
    {
      String str8 = e(((String)o.get("5F24")).substring(0, 4));
      if ((str8 == null) || (str8.length() == 0))
        return false;
      o.put("ED", str8);
    }
    return true;
  }

  private String f()
  {
    StringBuffer localStringBuffer = new StringBuffer("80A800000b8309");
    Iterator localIterator1 = h("9F7A019F02065F2A02").iterator();
    while (true)
    {
      if (!localIterator1.hasNext())
        break label105;
      String str1 = (String)localIterator1.next();
      Iterator localIterator2 = o.keySet().iterator();
      if (localIterator2.hasNext())
      {
        String str2 = (String)localIterator2.next();
        if (str1.compareToIgnoreCase(str2) != 0)
          break;
        localStringBuffer.append((String)o.get(str2));
      }
    }
    label105: return a(e.a(localStringBuffer.toString()));
  }

  private String f(String paramString)
  {
    int i1 = 0;
    this.g = this.i;
    byte[] arrayOfByte1 = { -128, 26, 20, 1, 0 };
    byte[] arrayOfByte2 = { -128, -6, 0, 0, 0 };
    StringBuilder localStringBuilder = new StringBuilder();
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Integer.valueOf(paramString.length());
    String str1 = String.format("%02d", arrayOfObject) + paramString;
    StringBuffer localStringBuffer = new StringBuffer(str1);
    while (i1 < 16 - str1.length())
    {
      localStringBuffer.append("F");
      i1++;
    }
    b(arrayOfByte1);
    String str2 = a(arrayOfByte2, localStringBuffer.toString());
    if (str2 != null)
      o.put("PIN", str2);
    this.g = this.h;
    return str2;
  }

  private String g()
  {
    this.g = this.i;
    String str = a(new byte[] { 0, -80, -126, 0, 10 });
    if ((str != null) && (str.length() != 0))
      o.put("CSN", str);
    this.g = this.h;
    return str;
  }

  private String g(String paramString)
  {
    this.g = this.i;
    byte[] arrayOfByte1 = { -128, 26, 21, 1, 8 };
    byte[] arrayOfByte2 = { -128, -6, 1, 0, 0 };
    String str1 = a(paramString, true);
    b(arrayOfByte1);
    while (str1.length() > 448)
    {
      arrayOfByte2[2] = 3;
      a(arrayOfByte2, str1.substring(0, 448).toUpperCase());
      str1 = str1.substring(448);
    }
    arrayOfByte2[2] = 1;
    if (Build.VERSION.SDK_INT <= 10);
    try
    {
      Thread.sleep(1000L);
      String str2 = a(arrayOfByte2, str1);
      if (str2 != null)
        o.put("MAC", str2.toUpperCase());
      this.g = this.h;
      if (str2 != null)
        str2 = str2.toUpperCase();
      return str2;
    }
    catch (InterruptedException localInterruptedException)
    {
      while (true)
        localInterruptedException.printStackTrace();
    }
  }

  private static Bundle h()
  {
    Bundle localBundle = new Bundle();
    localBundle.putString("action_resp_code", "0000");
    return localBundle;
  }

  private static List<String> h(String paramString)
  {
    ArrayList localArrayList = new ArrayList();
    if (paramString == null)
      return localArrayList;
    byte[] arrayOfByte1 = e.a(paramString);
    int i1 = 0;
    if (i1 < arrayOfByte1.length)
      if ((byte)(0x1F & arrayOfByte1[i1]) != 31)
        break label127;
    label127: for (int i2 = 2; ; i2 = 1)
    {
      byte[] arrayOfByte2 = new byte[i2];
      System.arraycopy(arrayOfByte1, i1, arrayOfByte2, 0, i2);
      localArrayList.add(e.a(arrayOfByte2, i2));
      int i3 = i2 + i1;
      if ((i3 < arrayOfByte1.length) && ((byte)(0x80 & arrayOfByte1[i3]) == -128));
      for (int i4 = 1 + (0x7F & arrayOfByte1[i3]); ; i4 = 1)
      {
        i1 = i4 + i3;
        break;
        return localArrayList;
      }
    }
  }

  public final Bundle a(int paramInt, String paramString1, HashMap<String, String> paramHashMap, String paramString2)
  {
    try
    {
      h.c("uppay", "startUPCardPurchase() +++");
      Bundle localBundle1 = h();
      this.c.b();
      String str1 = a();
      Bundle localBundle2;
      if ((str1 == null) || (str1.length() == 0))
      {
        this.c.c();
        localBundle1.putString("action_resp_code", "10019");
        localBundle2 = localBundle1;
      }
      String str3;
      while (true)
      {
        return localBundle2;
        h.c("uppay", " ************T1=" + m);
        o.put("PIN", paramString1);
        String str2 = f(PreferenceUtils.decPrefData((String)o.get("PIN"), paramString2));
        if ((str2 == null) || (str2.length() == 0))
        {
          this.c.c();
          localBundle1.putString("action_resp_code", "10019");
          localBundle2 = localBundle1;
        }
        else
        {
          h.c("uppay", " ************T2=" + m);
          str3 = a(paramInt, m);
          if ((str3 == null) || (str3.length() == 0))
          {
            this.c.c();
            localBundle1.putString("action_resp_code", "10019");
            localBundle2 = localBundle1;
          }
          else
          {
            String str4 = g();
            if ((str4 != null) && (str4.length() != 0))
              break;
            this.c.c();
            localBundle1.putString("action_resp_code", "10019");
            localBundle2 = localBundle1;
          }
        }
      }
      String str5 = e.c(str3.substring(40, 60));
      String str6 = str3.substring(60, 100);
      String str7 = str3.substring(100, 208);
      String str8 = str3.substring(216, 232);
      while (true)
      {
        JSONObject localJSONObject1;
        try
        {
          localJSONObject1 = new JSONObject();
          localJSONObject1.put("v", this.f);
          localJSONObject1.put("cmd", "pay");
          JSONObject localJSONObject2 = new JSONObject();
          localJSONObject1.put("params", localJSONObject2);
          localJSONObject2.put("pay_type", "2");
          localJSONObject2.put("pay_mode", "1");
          localJSONObject2.put("bind", "no");
          localJSONObject2.put("carrier_tp", "1");
          localJSONObject2.put("track2_data", str6);
          localJSONObject2.put("track3_data", str7);
          localJSONObject2.put("csn", o.get("CSN"));
          localJSONObject2.put("submit_time", m);
          localJSONObject2.put("sp_id", "8889");
          localJSONObject2.put("pin", o.get("PIN"));
          localJSONObject2.put("pan", str5);
          localJSONObject2.put("dynamic_key_data", str8);
          localJSONObject2.put("carrier_app_tp", "1");
          if ((paramHashMap == null) || (paramHashMap.keySet() == null) || (paramHashMap.keySet().size() <= 0))
            break label728;
          paramHashMap.remove("pan");
          paramHashMap.remove("pin");
          Iterator localIterator = paramHashMap.keySet().iterator();
          if (!localIterator.hasNext())
            break label728;
          String str10 = (String)localIterator.next();
          localJSONObject2.put(str10, paramHashMap.get(str10));
          continue;
        }
        catch (JSONException localJSONException)
        {
          localJSONException.printStackTrace();
          localObject2 = "";
          h.c("uppay", " ************T3=" + m);
          localBundle1.putString("action_resp_message", this.d.a((String)localObject2));
          this.c.c();
          d();
          localBundle2 = localBundle1;
        }
        break;
        label728: String str9 = localJSONObject1.toString();
        Object localObject2 = str9;
      }
    }
    finally
    {
    }
  }

  public final Bundle a(AppIdentification paramAppIdentification, String paramString1, String paramString2, HashMap<String, String> paramHashMap1, HashMap<String, String> paramHashMap2, String paramString3)
  {
    Bundle localBundle1;
    Bundle localBundle2;
    while (true)
    {
      try
      {
        this.c.b();
        h.c("uppay", "startPBOCPurchase() +++");
        d();
        o.put("PIN", paramString1);
        o.put("9F02", paramHashMap1.get("trans_amt"));
        o.put("9F1A", "0156");
        o.put("5F2A", paramHashMap1.get("trans currcy code"));
        o.put("9C", paramHashMap1.get("trans_type"));
        String str1 = paramAppIdentification.a();
        localBundle1 = h();
        l = new Date(System.currentTimeMillis());
        m = new SimpleDateFormat("yyyyMMddHHmmss").format(l);
        this.n = new String(m);
        String str2 = a();
        if ((str2 == null) || (str2.length() == 0))
        {
          localBundle1.putString("action_resp_code", "10019");
          if (localBundle1.getString("action_resp_code") == "0000")
            break label399;
          this.c.c();
          localBundle2 = localBundle1;
          return localBundle2;
        }
        String str10 = b(str1);
        if ((str10 == null) || (str10.length() == 0))
        {
          localBundle1.putString("action_resp_code", "10019");
          continue;
        }
      }
      finally
      {
      }
      String str11 = f();
      if ((str11 == null) || (str11.length() == 0))
      {
        localBundle1.putString("action_resp_code", "10020");
      }
      else
      {
        String str12 = c(str11);
        if ((str12 == null) || (str12.length() == 0))
        {
          localBundle1.putString("action_resp_code", "10019");
        }
        else
        {
          String str13 = d(str12);
          if ((str13 == null) || (str13.length() == 0))
          {
            localBundle1.putString("action_resp_code", "10019");
          }
          else
          {
            String str14 = g();
            if ((str14 == null) || (str14.length() == 0))
            {
              localBundle1.putString("action_resp_code", "10019");
              continue;
              label399: String str3 = f(PreferenceUtils.decPrefData((String)o.get("PIN"), paramString3));
              if ((str3 == null) || (str3.length() == 0))
              {
                this.c.c();
                localBundle1.putString("action_resp_code", "10019");
                localBundle2 = localBundle1;
              }
              else if (!e())
              {
                this.c.c();
                localBundle1.putString("action_resp_code", "10019");
                localBundle2 = localBundle1;
              }
              else
              {
                StringBuffer localStringBuffer = new StringBuffer();
                a("9F26", localStringBuffer);
                a("9F27", localStringBuffer);
                a("9F10", localStringBuffer);
                a("9F37", localStringBuffer);
                a("9F36", localStringBuffer);
                a("95", localStringBuffer);
                a("9A", localStringBuffer);
                a("9C", localStringBuffer);
                a("9F02", localStringBuffer);
                a("5F2A", localStringBuffer);
                a("82", localStringBuffer);
                a("9F1A", localStringBuffer);
                a("9F03", localStringBuffer);
                a("9F33", localStringBuffer);
                a("9F34", localStringBuffer);
                a("9F35", localStringBuffer);
                a("9F1E", localStringBuffer);
                String str4 = localStringBuffer.toString();
                o.put("DCD", str4);
                if ((o.get("TID") != null) && (o.get("AMT") != null) && (o.get("CUR") != null) && (o.get("AN1") != null) && (o.get("CSN") != null) && (o.get("5F34") != null))
                  break;
                this.c.c();
                localBundle1.putString("action_resp_code", "10019");
                localBundle2 = localBundle1;
              }
            }
          }
        }
      }
    }
    ArrayList localArrayList = new ArrayList();
    localArrayList.add(m);
    if (o.get("TID") != null)
      localArrayList.add(o.get("TID"));
    if (o.get("AMT") != null)
      localArrayList.add(o.get("AMT"));
    if (o.get("CUR") != null)
      localArrayList.add(o.get("CUR"));
    if (o.get("AN1") != null)
      localArrayList.add(o.get("AN1"));
    o.put("AN1", e.c((String)o.get("5A")));
    if (o.get("CSN") != null)
      localArrayList.add(o.get("CSN"));
    if ((this.p) && (o.get("ED") != null))
      localArrayList.add(o.get("ED"));
    if (o.get("5F34") != null)
      localArrayList.add(o.get("5F34"));
    if (o.get("DCD") != null)
      localArrayList.add(o.get("DCD"));
    Object localObject2 = "";
    Iterator localIterator1 = localArrayList.iterator();
    while (true)
    {
      if (localIterator1.hasNext())
      {
        String str9 = (String)localIterator1.next();
        if (str9 != null)
        {
          localObject3 = (String)localObject2 + str9 + " ";
          break label1623;
        }
      }
      else
      {
        String str5 = g(((String)localObject2).trim());
        if ((str5 == null) || (str5.length() == 0))
        {
          this.c.c();
          localBundle1.putString("action_resp_code", "10019");
          localBundle2 = localBundle1;
          break;
        }
        JSONObject localJSONObject1;
        while (true)
        {
          try
          {
            localJSONObject1 = new JSONObject();
            localJSONObject1.put("v", this.f);
            localJSONObject1.put("cmd", "pay");
            JSONObject localJSONObject2 = new JSONObject();
            localJSONObject1.put("params", localJSONObject2);
            localJSONObject2.put("pay_type", "2");
            localJSONObject2.put("pay_mode", "1");
            localJSONObject2.put("bind", "no");
            localJSONObject2.put("carrier_tp", paramString2);
            localJSONObject2.put("icc_data", o.get("DCD"));
            localJSONObject2.put("csn", o.get("CSN"));
            if (o.get("5F34") == null)
              break label1567;
            str6 = (String)o.get("5F34");
            localJSONObject2.put("card_seq_id", str6);
            localJSONObject2.put("submit_time", m);
            localJSONObject2.put("sp_id", "8889");
            localJSONObject2.put("pin", o.get("PIN"));
            localJSONObject2.put("pan", o.get("AN1"));
            localJSONObject2.put("carrier_app_tp", "2");
            if (o.get("ED") != null)
              localJSONObject2.put("expire", o.get("ED"));
            if (o.get("TD2") != null)
              localJSONObject2.put("track2_data", o.get("TD2"));
            if ((paramHashMap2 == null) || (paramHashMap2.keySet() == null) || (paramHashMap2.keySet().size() <= 0))
              break label1574;
            paramHashMap2.remove("pan");
            paramHashMap2.remove("pin");
            Iterator localIterator2 = paramHashMap2.keySet().iterator();
            if (!localIterator2.hasNext())
              break label1574;
            String str8 = (String)localIterator2.next();
            localJSONObject2.put(str8, paramHashMap2.get(str8));
            continue;
          }
          catch (JSONException localJSONException)
          {
            this.c.c();
            localBundle1.putString("action_resp_code", "10019");
            localBundle2 = localBundle1;
          }
          break;
          label1567: String str6 = "";
        }
        label1574: String str7 = localJSONObject1.toString();
        localBundle1.putString("action_resp_message", this.d.a(str7));
        this.c.c();
        d();
        localBundle2 = localBundle1;
        break;
      }
      Object localObject3 = localObject2;
      label1623: localObject2 = localObject3;
    }
  }

  public final String a()
  {
    this.g = this.i;
    return a(new byte[] { 0, -92, 4, 0, 15, -96, 0, 0, 3, 51, 67, 85, 80, 45, 77, 79, 66, 73, 76, 69 });
  }

  public final String a(int paramInt, String paramString)
  {
    this.g = this.i;
    if (Integer.toHexString(paramInt).length() == 1);
    for (String str = "0" + Integer.toHexString(paramInt); ; str = Integer.toHexString(paramInt))
      return a(e.a("80F802" + str + "08" + paramString + "80"));
  }

  public final String a(AppIdentification paramAppIdentification)
  {
    try
    {
      String str1 = paramAppIdentification.a();
      d();
      b(str1);
      String str2 = f();
      String str3 = null;
      if (str2 != null)
      {
        int i1 = str2.length();
        str3 = null;
        if (i1 != 0)
          break label50;
      }
      while (true)
      {
        return str3;
        label50: String str4 = c(str2);
        str3 = null;
        if (str4 != null)
        {
          int i2 = str4.length();
          str3 = null;
          if (i2 != 0)
            str3 = (String)o.get("5A");
        }
      }
    }
    finally
    {
    }
  }

  public final String a(String paramString)
  {
    this.c.d();
    String str = b(paramString);
    this.c.d();
    return a(str, "84");
  }

  public final ArrayList<com.unionpay.mobile.android.model.c> b()
  {
    this.c.d();
    this.c.b();
    ArrayList localArrayList = this.c.a(this);
    this.c.c();
    return localArrayList;
  }

  public final String c()
  {
    this.g = this.i;
    return a(e.a("80F2000102"));
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.unionpay.mobile.android.pboctransaction.d
 * JD-Core Version:    0.6.2
 */